Merge "API: Update main description to reflect reality"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 28 Feb 2018 17:12:57 +0000 (17:12 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 28 Feb 2018 17:12:57 +0000 (17:12 +0000)
includes/auth/AuthManager.php
includes/page/WikiPage.php
includes/parser/StripState.php
languages/messages/MessagesSd.php

index 47c0df5..9ed6d13 100644 (file)
@@ -1416,7 +1416,7 @@ class AuthManager implements LoggerAwareInterface {
                                $state['userid'] = $user->getId();
 
                                // Update user count
-                               \DeferredUpdates::addUpdate( new \SiteStatsUpdate( 0, 0, 0, 0, 1 ) );
+                               \DeferredUpdates::addUpdate( \SiteStatsUpdate::factory( [ 'users' => 1 ] ) );
 
                                // Watch user's userpage and talk page
                                $user->addWatch( $user->getUserPage(), User::IGNORE_USER_RIGHTS );
@@ -1730,7 +1730,7 @@ class AuthManager implements LoggerAwareInterface {
                $user->saveSettings();
 
                // Update user count
-               \DeferredUpdates::addUpdate( new \SiteStatsUpdate( 0, 0, 0, 0, 1 ) );
+               \DeferredUpdates::addUpdate( \SiteStatsUpdate::factory( [ 'users' => 1 ] ) );
                // Watch user's userpage and talk page
                \DeferredUpdates::addCallableUpdate( function () use ( $user ) {
                        $user->addWatch( $user->getUserPage(), User::IGNORE_USER_RIGHTS );
index d266e1d..ca7d747 100644 (file)
@@ -2774,7 +2774,7 @@ class WikiPage implements Page, IDBAccessObject {
         * @param int $u1 Unused
         * @param bool $u2 Unused
         * @param array|string &$error Array of errors to append to
-        * @param User $user The deleting user
+        * @param User $deleter The deleting user
         * @param array $tags Tags to apply to the deletion action
         * @param string $logsubtype
         * @return Status Status object; if successful, $status->value is the log_id of the
@@ -2782,7 +2782,7 @@ class WikiPage implements Page, IDBAccessObject {
         *   found, $status is a non-fatal 'cannotdelete' error
         */
        public function doDeleteArticleReal(
-               $reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $user = null,
+               $reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $deleter = null,
                $tags = [], $logsubtype = 'delete'
        ) {
                global $wgUser, $wgContentHandlerUseDB, $wgCommentTableSchemaMigrationStage,
@@ -2801,9 +2801,9 @@ class WikiPage implements Page, IDBAccessObject {
                // Avoid PHP 7.1 warning of passing $this by reference
                $wikiPage = $this;
 
-               $user = is_null( $user ) ? $wgUser : $user;
+               $deleter = is_null( $deleter ) ? $wgUser : $deleter;
                if ( !Hooks::run( 'ArticleDelete',
-                       [ &$wikiPage, &$user, &$reason, &$error, &$status, $suppress ]
+                       [ &$wikiPage, &$deleter, &$reason, &$error, &$status, $suppress ]
                ) ) {
                        if ( $status->isOK() ) {
                                // Hook aborted but didn't set a fatal status
@@ -2947,7 +2947,7 @@ class WikiPage implements Page, IDBAccessObject {
                $logtype = $suppress ? 'suppress' : 'delete';
 
                $logEntry = new ManualLogEntry( $logtype, $logsubtype );
-               $logEntry->setPerformer( $user );
+               $logEntry->setPerformer( $deleter );
                $logEntry->setTarget( $logTitle );
                $logEntry->setComment( $reason );
                $logEntry->setTags( $tags );
@@ -2963,11 +2963,11 @@ class WikiPage implements Page, IDBAccessObject {
 
                $dbw->endAtomic( __METHOD__ );
 
-               $this->doDeleteUpdates( $id, $content, $revision, $user );
+               $this->doDeleteUpdates( $id, $content, $revision, $deleter );
 
                Hooks::run( 'ArticleDeleteComplete', [
                        &$wikiPageBeforeDelete,
-                       &$user,
+                       &$deleter,
                        $reason,
                        $id,
                        $content,
index 298aad3..5d6385e 100644 (file)
@@ -30,7 +30,6 @@ class StripState {
        protected $data;
        protected $regex;
 
-       protected $tempType, $tempMergePrefix;
        protected $circularRefGuard;
        protected $recursionLevel = 0;
 
@@ -122,44 +121,37 @@ class StripState {
                        return $text;
                }
 
-               $oldType = $this->tempType;
-               $this->tempType = $type;
-               $text = preg_replace_callback( $this->regex, [ $this, 'unstripCallback' ], $text );
-               $this->tempType = $oldType;
-               return $text;
-       }
-
-       /**
-        * @param array $m
-        * @return array
-        */
-       protected function unstripCallback( $m ) {
-               $marker = $m[1];
-               if ( isset( $this->data[$this->tempType][$marker] ) ) {
-                       if ( isset( $this->circularRefGuard[$marker] ) ) {
-                               return '<span class="error">'
-                                       . wfMessage( 'parser-unstrip-loop-warning' )->inContentLanguage()->text()
-                                       . '</span>';
-                       }
-                       if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) {
-                               return '<span class="error">' .
-                                       wfMessage( 'parser-unstrip-recursion-limit' )
-                                               ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() .
-                                       '</span>';
+               $callback = function ( $m ) use ( $type ) {
+                       $marker = $m[1];
+                       if ( isset( $this->data[$type][$marker] ) ) {
+                               if ( isset( $this->circularRefGuard[$marker] ) ) {
+                                       return '<span class="error">'
+                                               . wfMessage( 'parser-unstrip-loop-warning' )->inContentLanguage()->text()
+                                               . '</span>';
+                               }
+                               if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) {
+                                       return '<span class="error">' .
+                                               wfMessage( 'parser-unstrip-recursion-limit' )
+                                                       ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() .
+                                               '</span>';
+                               }
+                               $this->circularRefGuard[$marker] = true;
+                               $this->recursionLevel++;
+                               $value = $this->data[$type][$marker];
+                               if ( $value instanceof Closure ) {
+                                       $value = $value();
+                               }
+                               $ret = $this->unstripType( $type, $value );
+                               $this->recursionLevel--;
+                               unset( $this->circularRefGuard[$marker] );
+                               return $ret;
+                       } else {
+                               return $m[0];
                        }
-                       $this->circularRefGuard[$marker] = true;
-                       $this->recursionLevel++;
-                       $value = $this->data[$this->tempType][$marker];
-                       if ( $value instanceof Closure ) {
-                               $value = $value();
-                       }
-                       $ret = $this->unstripType( $this->tempType, $value );
-                       $this->recursionLevel--;
-                       unset( $this->circularRefGuard[$marker] );
-                       return $ret;
-               } else {
-                       return $m[0];
-               }
+               };
+
+               $text = preg_replace_callback( $this->regex, $callback, $text );
+               return $text;
        }
 
        /**
@@ -215,21 +207,14 @@ class StripState {
                        }
                }
 
-               $this->tempMergePrefix = $mergePrefix;
-               $texts = preg_replace_callback( $otherState->regex, [ $this, 'mergeCallback' ], $texts );
-               $this->tempMergePrefix = null;
+               $callback = function ( $m ) use ( $mergePrefix ) {
+                       $key = $m[1];
+                       return Parser::MARKER_PREFIX . $mergePrefix . '-' . $key . Parser::MARKER_SUFFIX;
+               };
+               $texts = preg_replace_callback( $otherState->regex, $callback, $texts );
                return $texts;
        }
 
-       /**
-        * @param array $m
-        * @return string
-        */
-       protected function mergeCallback( $m ) {
-               $key = $m[1];
-               return Parser::MARKER_PREFIX . $this->tempMergePrefix . '-' . $key . Parser::MARKER_SUFFIX;
-       }
-
        /**
         * Remove any strip markers found in the given text.
         *
index 4d4a48e..6275f7d 100644 (file)
@@ -16,21 +16,30 @@ $namespaceNames = [
        NS_MEDIA            => 'ذريعات',
        NS_SPECIAL          => 'خاص',
        NS_TALK             => 'بحث',
-       NS_USER             => 'Ù\8aÙ\88زر',
-       NS_USER_TALK        => 'Ù\8aÙ\88زر_بحث',
+       NS_USER             => 'Ù\88اپرائÙ\8aÙ\86دÚ\99',
+       NS_USER_TALK        => 'Ù\88اپرائÙ\8aÙ\86دÚ\99_بحث',
        NS_PROJECT_TALK     => '$1_بحث',
-       NS_FILE             => 'عڪس',
-       NS_FILE_TALK        => 'عڪس_بحث',
+       NS_FILE             => 'فائل',
+       NS_FILE_TALK        => 'فائل_بحث',
        NS_MEDIAWIKI        => 'ذريعات_وڪي',
        NS_MEDIAWIKI_TALK   => 'ذريعات_وڪي_بحث',
        NS_TEMPLATE         => 'سانچو',
-       NS_TEMPLATE_TALK    => 'سنچو_بحث',
+       NS_TEMPLATE_TALK    => 'سانچو_بحث',
        NS_HELP             => 'مدد',
        NS_HELP_TALK        => 'مدد_بحث',
        NS_CATEGORY         => 'زمرو',
        NS_CATEGORY_TALK    => 'زمرو_بحث',
 ];
 
+$namespaceAliases = [
+       'يوزر' => NS_USER,
+       'يوزر_بحث' => NS_USER_TALK,
+       'عڪس' => NS_FILE,
+       'عڪس_بحث' => NS_FILE_TALK,
+       'سنچو' => NS_TEMPLATE,
+       'سنچو_بحث' => NS_TEMPLATE_TALK,
+];
+
 $specialPageAliases = [
        'Allmessages'               => [ 'سڀ نياپا' ],
        'Allpages'                  => [ 'سڀ صفحا' ],